import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormBuilder, Validators } from '@angular/forms';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { ApiService } from 'src/app/core/api';
import { MessageService } from 'src/app/core/service/message.service';
import { DatePipe } from '@angular/common';
 
/**
 * 首页
 */

@Component({
    templateUrl: './accountInfo.html',
    styleUrls: ['./accountInfo.scss'],
})
export class AccountInfoComponent implements OnInit {
    account = {};
    validateForm;
    ngOnInit() {
        this.validateForm = this.fb.group({
            loginId: [null, [Validators.required]],  // 企业账号
            name: [null, [Validators.required]],  // 城市编号 (固定)
            code: [null, [Validators.required]],  // 市区编号 
            zipcode: [null, [Validators.required]],  // 详细地址 
            natureType: [null, [Validators.required]],  // 企业名称
            address: [null, [Validators.required]],  // 机构代码
            provinceId: [null, [Validators.required]],  // 邮政编码
            cityId: [null, [Validators.required]],  // 企业性质 StateOwned国有企业
            areaId: [null, [Validators.required]],  // 行业分类编号
            legalPerson: [null, [Validators.required]],  // 企业法人
            securityDirector: [null, [Validators.required]],  // 安全主管
            contactTel: [null, [Validators.required]],  // 联系电话
            contactEmail: [null, [Validators.required]],  // 联系邮箱
        });
        this.apiService.post('用户详情',{}).then((res:any)=>{
            this.account = res.data.enterpriseUserDetail;
            this.validateForm.patchValue(this.account);
        })
    }
    constructor(
        private router: Router,
        private fb: FormBuilder,
        private apiService: ApiService,
        private message: MessageService,
        private nzMessageService: NzMessageService,
        private modal: NzModalService,
        private datePipe:DatePipe
    ) { }
}
